// index.js
// 获取应用实例
const app = getApp()
import { request } from '../../request/index.js';
const regeneratorRuntime = require('../../lib/runtime/runtime.js');

Page({
  data: {
    /* 轮播图数据 */
    swiperList: [],
    /* 导航分类数据 */
    navBarList: [],
    /* 楼层list */
    floorList: [],
  },
  // 页面加载时会触发的生命周期函数
  onLoad() {
    let that = this;
    // 发送异步请求
    that.getSwiperList();
    that.getNavBarList();
    that.getFloorList();
  },

  // 获取轮播图数据
  async getSwiperList() {
    let res = await request({ url: '/home/swiperdata' });
    this.setData({
      swiperList: res,
    })
  },
  // 获取导航分类数据
  async getNavBarList() {
    let res = await request({ url: '/home/catitems' });
    this.setData({
      navBarList: res,
    })
  },
  // 获取楼层数据
  async getFloorList() {
    let res = await request({ url: '/home/floordata' });
    this.setData({
      floorList: res,
    })
  },

})
